
<?
$id = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
if(isset($id)){
		
		$commentRow = CommentPeer::getInstance()->findById($id);
		
		if(!$commentRow[0]["unreg_user_name"]){
		
			$db = Db::getConnection ();
			$sql = '
			select `product`.`name` as prod_name, `product`.`id` as prod_id,  `profile`.*
			from `comment`
			inner join `product` on `comment`.item_id = `product`.id
			inner join `profile` on `comment`.profile_id = `profile`.id
			where `comment`.id = '.$id;
			$row = $db->fetchRow ( $sql );
			
			echo "Пользователь <b>".$row["first_name"]." ".$row["last_name"]." </b><br>";
			echo $row["email"]."<br>";
			echo "<b>".$row["prod_name"]." </b> ID:".$row["prod_id"]." <br>";
			
		}else{		
			$db = Db::getConnection ();
			$sql = '
			select `product`.`name` as prod_name, `product`.`id` as prod_id
			from `comment`
			inner join `product` on `comment`.item_id = `product`.id
			where `comment`.id = '.$id;
			$row = $db->fetchRow ( $sql );
			//var_dump($sql);
			
			echo "Незарегистрированный пользователь <b>".$commentRow[0]["unreg_user_name"]." </b><br>";
			echo $commentRow[0]["unreg_user_email"]."<br>";
			echo "<b>".$row["prod_name"]." </b> ID:".$row["prod_id"]." <br>";
			
			}
			
}
		?>


<?php 

$form = $this->element;
$form->clearDecorators();
$form->loadDefaultDecorators();
$form->getElement('admin_answer')->setAttrib("class", "");
echo $form;
?>

